<?php

namespace common\models\db\tables;

use Yii;

/**
 * This is the model class for table "{{%admin_power}}".
 *
 * @property int $id
 * @property string $name 名称
 * @property string $route 路由
 * @property string|null $desc 介绍
 * @property string|null $icon 菜单图标
 * @property int|null $pid 父级id
 * @property string|null $path 级别路径
 * @property int|null $created_by
 * @property int|null $updated_by
 * @property int $created_at
 * @property int|null $updated_at
 * @property int|null $deleted_at
 * @property int $status 10正常
 * @property int $sort 排序，升序，默认0
 * @property int $type 1菜单 2方法
 */
class AdminPower extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%admin_power}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['name', 'route', 'desc', 'icon', 'pid', 'path', 'created_by', 'updated_by', 'created_at', 'updated_at', 'deleted_at', 'status', 'sort', 'type'], 'trim'],
            [['name', 'route', 'created_at'], 'required'],
            [['pid', 'created_by', 'updated_by', 'created_at', 'updated_at', 'deleted_at', 'status', 'sort', 'type'], 'integer'],
            [['name', 'route', 'desc', 'icon', 'path'], 'string', 'max' => 180],
            [['desc', 'icon', 'pid', 'path', 'created_by', 'updated_by', 'updated_at', 'deleted_at'], 'default', 'value' => null],
            [['status'], 'default', 'value' => 10],
            [['sort'], 'default', 'value' => 0],
            [['type'], 'default', 'value' => 1],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'name' => Yii::t('app', '名称'),
            'route' => Yii::t('app', '路由'),
            'desc' => Yii::t('app', '介绍'),
            'icon' => Yii::t('app', '菜单图标'),
            'pid' => Yii::t('app', '父级id'),
            'path' => Yii::t('app', '级别路径'),
            'created_by' => Yii::t('app', 'Created By'),
            'updated_by' => Yii::t('app', 'Updated By'),
            'created_at' => Yii::t('app', 'Created At'),
            'updated_at' => Yii::t('app', 'Updated At'),
            'deleted_at' => Yii::t('app', 'Deleted At'),
            'status' => Yii::t('app', '10正常'),
            'sort' => Yii::t('app', '排序，升序，默认0'),
            'type' => Yii::t('app', '1菜单 2方法'),
        ];
    }
}
